//package com.corpgovernment.organization.producer;
//
//import com.corpgovernment.api.messageadvice.vo.MessageVo;
//import com.corpgovernment.common.mq.enums.MessageBizTypeEnum;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.rocketmq.client.producer.DefaultMQProducer;
//import org.apache.rocketmq.client.producer.SendResult;
//import org.apache.rocketmq.client.producer.SendStatus;
//import org.apache.rocketmq.common.message.Message;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//@Slf4j
//@Component
//public class SendMessageMQProducer {
//
//    @Autowired
//    private DefaultMQProducer defaultMQProducer;
//
//    public boolean sendMsg(MessageVo messageVo) {
//        try {
//            Message message = new Message();
//            message.setTopic(MessageBizTypeEnum.SEND_MESSAGE.getTopic());
//            message.setBody(JSON.toJSONString(messageVo).getBytes());
//            message.setTags(MessageBizTypeEnum.SEND_MESSAGE.getTags());
//            SendResult result = defaultMQProducer.send(message);
//            if (result != null && result.getSendStatus() == SendStatus.SEND_OK) {
//                log.info("发送订单状态推送成功,messageVo:{}", messageVo);
//                return true;
//            }
//        } catch (Exception e) {
//            log.error("发送订单状态推送失败:{}", e.getMessage());
//        }
//        return false;
//    }
//
//}
